package com.example.module22.controller;

import com.example.atguiguagespringbootstarter.service.AgeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DemoController {

    @Value("${happy.message}")
    private String happyMessage;

    @Value("${example.birthday}")
    private String birthday;

    @Autowired
    private AgeService ageService;

    @GetMapping("/test/demo")
    public String testDemo() {
        return happyMessage;
    }

    @GetMapping("/test/starter")
    public String testStarter() {
        return birthday + "日期出生的人，计算得到的年龄是：" + ageService.computeAgeByBirthday();
    }

}
